<?php
namespace Home\Controller;
use Common\Controller\HomeBaseController;
/**
 * 首页控制器
 */
class IndexController extends HomeBaseController{
	/**
	 * 首页
	 */
	public function index(){
	    redirect('/index.php/Login/index');
		
		//公告
		$Notice =M('Article');
		$map['ac_id']=10;
		$map['article_show']=1;
		$notice =$Notice->field('article_content')->where($map)->select();
		
		
		
		//首页轮播图
		$Banner =M('Banner');	
		$banners =$Banner->field('adv_pic')->where('adv_site=0')->select();

		$this->assign('notice',$notice);
		$this->assign('banners',$banners);
		$this->assign('title','首页-皇彩鸿娱乐平台');
		$this->assign('curr','index'); 
		$this->display();
	}
	public function check_session(){
		if($_SESSION['member_id']>0){
			$data['status']=0;
			$this->ajaxReturn($data);
		}else{
		$data['status']=1;
			$this->ajaxReturn($data);	
		}
	}
	//公告详情
	public function shownotice(){

		$Notice =M('Article');
		$map['ac_id']=10;
		$map['article_show']=1;
		$notice =$Notice->field('article_time,article_content')->where($map)->select();
		$this->assign('notice',$notice);
	    $this->display('details');
	}
	
	//优惠活动
	public function huodong(){
	    $Acticity =M('Article');
	    $map['ac_id']=12;
	    $map['article_show']=1;
	    
	    $acticity =$Acticity->field('article_title,article_content,article_id,article_img')->where($map)->select();
	    
	    $this->assign('activity',$acticity);
		$this->assign('curr','huodong');
		$this->assign('title','优惠活动-皇彩鸿娱乐平台');
		$this->display();
	}
	
	//常见问题
	public function problem(){
	    $id=I('id',0);

	    $Problem =M('Article');
	    $map['ac_id']=11;
	    $map['article_show']=1;
	    $problem =$Problem->field('article_title,article_id')->where($map)->select();
	    $map1['ac_id']=11;
	    $map1['article_show']=1;
	    $map1['article_id']=$id;
	    if($id>0){
            $detail =$Problem->field('article_title,article_content,article_id')->where($map1)->find();
	        
	    }else{
	         $detail =$Problem->field('article_title,article_content,article_id')->where($map)->order('article_id asc')->find();
	         $id=$detail['article_id'];
	    }
	   
	    $this->assign('curr','problem');
	    $this->assign('title','常见问题-皇彩鸿娱乐平台');
	    $this->assign('id',$id);
	    $this->assign('problem',$problem);
        $this->assign('detail',$detail);
		$this->display('article');
	}
	
		//更新账户金额
	public function account(){
		$balance=M('member')->where('member_id='.$_SESSION['member_id'])->getField('member_money');
		$betting=M('lottery_order')->where('m_id='.$_SESSION['member_id'].' and status=0')->sum('money');
		if(empty($betting)){
			$betting=0;
		}
		$data['balance']=$balance;
		$data['betting']=$betting;
		$this->ajaxReturn($data);	
	}
	public function mobile(){
		
		$this->display();
		}
	
	
	
	
	
 

	 
	 
	 
}
